package com.gms.util;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/*
* 获取时间
* */
public class ObtainDate {

    //获取今天时间
    public static Date nowDate(){
        Date now = new Date();
        LocalDate localDate=now.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        Date newDate=java.sql.Date.valueOf(localDate);
        return newDate;
    }

    //获取明天时间
    public static Date tomorrowDate(){
        Date now = new Date();
        LocalDate localDate=now.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        localDate = localDate.plusDays(1);
        Date tomorrowDate=java.sql.Date.valueOf(localDate);
        return tomorrowDate;
    }

    //获取一周的时间
    public static Date weekDate(){
        Date now = new Date();
        LocalDate localDate=now.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        Date newDate=java.sql.Date.valueOf(localDate);
        System.out.println(newDate);
        localDate = localDate.plusDays(7);
        Date weekDate=java.sql.Date.valueOf(localDate);
        System.out.println(weekDate);
        return weekDate;
    }

    public static List<String> timeList(){
        List<String> listtime = new ArrayList<>();
        listtime.add("08:00-09:00");
        listtime.add("09:00-10:00");
        listtime.add("10:00-11:00");
        listtime.add("11:00-12:00");
        listtime.add("12:00-13:00");
        listtime.add("13:00-14:00");
        listtime.add("14:00-15:00");
        listtime.add("15:00-16:00");
        listtime.add("16:00-17:00");
        listtime.add("17:00-18:00");
        listtime.add("18:00-19:00");
        listtime.add("19:00-20:00");
        listtime.add("20:00-21:00");
        return listtime;
    }
}
